﻿Imports System.Text
Imports System.IO

Public Class w0001
    Dim arrPI(0 To 2) As Integer
    Private Sub w0001_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ComboBox1.SelectedIndex = 0
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim arr() As String, arr1() As String
        Dim u As Integer = 0, u1 As Integer = 0, gua0 As Integer = 0
        Dim tmpS As String = ""
        Dim R As String = ""
        Dim sb As New StringBuilder
        Dim arrI(,) As Integer = change_array_zhixuan_to_zuxuan(tiqu_duoma_from_position(ComboBox1.Text, 3))

        Dim qishukuadu As Integer = 0
        For i = 0 To general_Ubound - 50
            If arrQH(i) = "20070405-004" Then

                Debug.Print("1")
            End If
            arr = get_2ma_from_3ma_array(i, arrI)
            u = UBound(arr)
            tmpS = get_2ma_from_3ma_string(i + 1, arrI)
            For k = 0 To u
                If tmpS.IndexOf(arr(k)) >= 0 Then
                    u1 = u1 + 1
                End If
            Next
            If u1 = 0 Then
                gua0 = gua0 + 1
                R = ""
                qishukuadu = 0
            Else
                R = R & u1.ToString & "　"
                qishukuadu = qishukuadu + 1
                sb.Append(arrQH(i + 1) & vbTab & R & vbTab & "跨度：" & vbTab & (qishukuadu + 1).ToString & vbTab & "间隔 " & vbTab & gua0 & vbCrLf)
                R = ""
                u1 = 0
                gua0 = 0
            End If
        Next
        TextBox1.Text = sb.ToString
    End Sub

    Private Sub ToolStripComboBox1_Click(sender As Object, e As EventArgs) Handles ToolStripComboBox1.Click

    End Sub

    Private Sub ToolStripComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged
        Dim tmps As String = ToolStripComboBox1.Text
        Dim arr() As String = tmps.Split(",")
        Dim u As Integer = UBound(arr)
        For i = 0 To u
            arrPI(i) = Val(arr(i)) - 1
        Next
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim arr() As String, arr1() As String
        Dim u As Integer = 0, u1 As Integer = 0, gua0 As Integer = 0
        Dim tmpS As String = ""
        Dim R As String = ""
        Dim sb As New StringBuilder
        Dim arrI(,) As Integer = change_array_zhixuan_to_zuxuan(tiqu_duoma_from_position(ComboBox1.Text, 3))

        Dim qishukuadu As Integer = 0
        For i = 0 To general_Ubound - 50
            If arrQH(i) = "20100407-018" Then

                Debug.Print("1")
            End If
            arr = get_2ma_from_3ma_array(i, arrI)
            u = UBound(arr)
            For j = i + 1 To general_Ubound
                tmpS = get_2ma_from_3ma_string(j, arrI)
                For k = 0 To u
                    If tmpS.IndexOf(arr(k)) >= 0 Then
                        u1 = u1 + 1
                    End If
                Next
                If u1 = 0 Then
                    If qishukuadu <> 0 Then
                        sb.Append(arrQH(i + 1) & vbTab & R & vbTab & "跨度：" & vbTab & (qishukuadu + 1).ToString & vbCrLf)
                    End If
                    gua0 = gua0 + 1
                    R = ""
                    qishukuadu = 0
                    Exit For
                Else
                    R = R & u1.ToString & "　"
                    qishukuadu = qishukuadu + 1
                    '
                    'R = ""
                    u1 = 0
                    'gua0 = 0
                End If

            Next

        Next
        TextBox1.Text = sb.ToString
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        Dim tmps As String = ComboBox1.Text
        Dim arr() As String = tmps.Split(",")
        Dim u As Integer = UBound(arr)
        For i = 0 To u
            arrPI(i) = Val(arr(i)) - 1
        Next
    End Sub
End Class